﻿using System;
using System.Collections;
using System.Text;

namespace Demo00
{
    class Program
    {

        public static IEnumerable TestCode1()
        {

            int x = 3;

            yield return "a";
            x++;
            yield return "b";
            x++;
            yield return "c";
            x++;
            yield return "d";
            x++;

            yield break;

        }


        public static IEnumerable TestCode2()
        {

            int x = 3;

            yield return x;
            x++;
            yield return x;
            x++;
            yield return x;
            x++;
            yield return x;
            x++;

            yield break;

        }




        static void Main(string[] args)
        {



            IEnumerator FSM = TestCode1().GetEnumerator();
            IEnumerator FSM2 = TestCode2().GetEnumerator();

            while (FSM.MoveNext() == true && FSM2.MoveNext())
            {

                Console.WriteLine("input any key");

                Console.ReadKey();
                Console.WriteLine("");
                Console.WriteLine("output = {0}", FSM.Current);
                Console.WriteLine("output = {0}", FSM2.Current);
            }

        }
    }
}
